<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title><spring:message code="message.lable.DICguiGeWeiHuJiLu"/></title>
<%@ include file="/WEB-INF/component/commonCSS.jsp"%>
<!--[if lt IE 9]>
    <script src="lib/js/html5shiv.min.js"></script>
    <script src="lib/js/respond.min.js"></script>
<![endif]-->
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1><spring:message code="message.lable.DICguiGeWeiHuJiLu"/></h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
            <li class="active"><a href="#"><spring:message code="message.lable.DicManage"/></a></li>
            <li class="active"><a href="#"><spring:message code="message.lable.drugspecDic"/></a></li>
        </ol>
    </section>
    <section class="content">
        <div class="box box-success">
            <div class="box-body">
                <div class="form-inline">
                    <div class="form-group form-group-xs">
                        <label><spring:message code="message.listForm.xiuGaiRiQi"/>：</label>
                        <input class="form-control" id = "date1" type="text" placeholder="yyyy-MM-dd" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'date2\')}'})" data-date-fmt="yyyy-MM-dd" />
                        <label>-</label>
                        <input class="form-control" id = "date2" type="text" placeholder="yyyy-MM-dd" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'date1\')}'})" data-date-fmt="yyyy-MM-dd" />
                    </div>
                    <button type="button" onclick="likeQuery();"class="btn btn-success btn-sm"><spring:message code="message.button.seachSpacing"/></button>
                </div>
            </div>
        </div>
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
        <div class="box box-warning bottongroup">
             <a href="${ctx }/dicDrugspec/dicDrugspecListJsp.html" class="btn btn-default btn-sm"><spring:message code="message.button.getBackSpacing"/></a>
        </div>
    </section>
    <%@ include file="/WEB-INF/component/commonJS.jsp"%>
    <script type="text/javascript">
        $(function () {
            
            $("#gridlist").jqGrid({
                url: "dicDrugspecLogList.html",
                mtype: "post",
                datatype: "json",
                postData:{"specId":"${specId}"},
                autowidth: true,
                height: 270,
                colNames: ['<spring:message code="message.jqGrid.cz"/>'
                           ,'<spring:message code="message.listForm.xiuGaiXiangQing"/>'
                           ,'一级规格编码','一级规格名称', '二级规格编码', '二级规格名称','状态',
                           '<spring:message code="message.listForm.xiuGaiRen"/>',
                           '<spring:message code="message.listForm.xiuGaiShiJian"/>'
                           ],
                colModel: [
					{ name: 'operate', width: 10,sortable: false, align:"center",
					    formatter : function(val, opts, rowdata)
					    {
					        return  "<a href='${ctx}/dicDrugspecLog/toDrugSpecHisDetail.html?logId="+rowdata.logId+"' style='background:url(${ctx}/lib/img/icon/icon.png) no-repeat -100px 0px' class='opIcon' title='<spring:message code="message.jqGrid.cz.xiangQing"/>'></a>";
					        
					    }
					},
					{ name: 'detail', width : 200, align : "left", sortable:false  },
					{ name: 'dicDrugspecCodeSpecCode', index: 'dicDrugspecCodeSpecCode', hidden:true, width: 100 , align: "center",formatter:function(cellvalue, options, row){if(row.dicDrugspecCode != null){ return row.dicDrugspecCode.specCode; }else{ return row.specCode; }}},
                    { name: 'dicDrugspecCodeSpecName', index: 'dicDrugspecCodeSpecName', hidden:true, width: 150 , align: "center",formatter:function(cellvalue, options, row){if(row.dicDrugspecCode!=null){ return row.dicDrugspecCode.specName; }else{ return row.specName; }}},
                    { name: 'specCode', index: 'specCode', hidden:true, width: 100, align: "center" ,formatter:function(cellvalue, options, row){if(row.dicDrugspecCode!=null){ return row.specCode; }else{ return ""; }} },
                    { name: 'specName', index: 'specName', hidden:true, width: 150 , align: "center",formatter:function(cellvalue, options, row){if(row.dicDrugspecCode!=null){ return row.specName; }else{ return ""; }}},
                    { name: 'status', index: 'status', hidden:true, width: 60, align: "center",
                    	formatter : function(val, opts, rowdata) {
                    		var strSta = "";
                    		if(rowdata.status == 1){
                    			strSta += "<spring:message code="message.button.start"/>";
                    		}else{
                    			strSta += "<spring:message code="message.button.stop"/>";
                    		}
                    		return strSta;
                    	}	
                    },
                    { name: 'updUser', index: 'updUser', width: 30, align: "left" },
                    { name: 'updDatetime', index: 'updDatetime', width: 35, align: "left",
                    	formatter:function(cellvalue, options, row){return CurentTime(new Date(cellvalue))}	
                    }
                      
                ],
                rowNum: 20,
                rowList: [10, 20, 50,100],
                rownumbers: true,
                pager: "#gridpage",
                viewrecords: true,
                gridComplete:function(){
                    //序号列宽度自适应（参数为jqgridID）
                    autoRNWidth("gridlist");
                    //数据只有一条时默认选中（参数为jqgridID）
                    selectByOneData("gridlist");
                },
                caption: "${specCode} - ${specName}&nbsp;<spring:message code="message.jqGrid.cz.weiHuJiLuLieBiao"/> ",
                jsonReader: {
                    repeatitems: false,
                    id: "ids"
                }
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");
        });
        
        function likeQuery(){
        	var date1  = $("#date1").val();
       	    var date2 = $("#date2").val();
       	 $("#gridlist").jqGrid('setGridParam', { 
       		 	url: "${pageContext.request.contextPath}/dicDrugspecLog/dicDrugspecLogList.html", 
       			datatype:'json',
                postData:{
               		 "specId":"${specId}",
               		 "date1":date1,
                	 "date2":date2
                },
       			 page: 1 
       			 }).trigger("reloadGrid");
        }
        
        function CurentTime(now)  
    	{       	         
    	    var year = now.getFullYear();   
    	    var month = now.getMonth() + 1; 
    	    var day = now.getDate();     
    	         
    	    var hh = now.getHours();       
    	    var mm = now.getMinutes(); 
    	    var ss=now.getSeconds(); 
    	    var clock = year + "-"; 
    	    if(month < 10) clock += "0";         
    	    clock += month + "-";  
    	    if(day < 10) clock += "0";   
    	    clock += day + " "; 
    	    if(hh < 10) clock += "0";  
    	    clock += hh + ":";  
    	    if (mm < 10) clock += '0';   
    	    clock += mm+ ":";  
    	    if (ss < 10) clock += '0';   
    	    clock += ss;  
    	    return(clock);   
    	}
        
    </script>
</body>
</html>